-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically pan initial map based on current location #30506
Automatically pan initial map based on current location #30506
Conversation
src/hooks/useLocalize.js
Outdated
* Hook to access the localization context which provides multiple utility functions and locale. | ||
* | ||
* @returns {LocalizationContext} The localization context | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed by @blazejkustra that this is the way we can handle it for now until useLocalize
is migrated to TS.
Without this type definition, usage of useLocalize
in MapView.tsx
would throw TS errors
@mananjadhav Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
@mananjadhav the perf test failure is probably a false alarm, as others also experience the same: https://github.com/Expensify/App/actions/runs/6768457070/job/18392931251?pr=30901 |
@MaciejSWM Started reviewing, can you please merge the latest main and resolve conflicts? |
@mananjadhav can we get this reviewed again today?? TY! |
Thanks for the bump, I'll have this finished today. |
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid-current-location-2.movandroid-current-location-1.movAndroid: mWeb Chromemweb-chrome-current-location.moviOS: Nativeios-current-location.moviOS: mWeb Safarimweb-safari-current-location.movMacOS: Chrome / Safariweb-current-location-2.movweb-current-location-1.movMacOS: Desktopdesktop-current-location_a0vhxiJw.mp4 |
@MaciejSWM I had one issue testing with mobile web chrome. The location shows momentarily and then goes black. Even when switching from default location to the user's location. Did you experience this? I have had this issue with my emulator earlier too, and I don't have a physical android device to test. But thought of clarifying with you before we merge. Also one comment about removing |
Holding until we get those last couple of comments addressed |
Hey @mananjadhav. I restored |
I'm having problems now to open it on any Android device - Emulator freezes once again because it runs out of memory. Physical device doesn't want to login to expensify because it's getting 429 Too many requests (tested ports 8082 and 8080) |
@mananjadhav I confirm that it's still all good on my side: android.mp4 |
Thanks for confirming @MaciejSWM. It must be my emulator. @thienlnam All good here. I've also check off the checklist for the pending |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/thienlnam in version: 1.4.4-0 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.4.4-3 🚀
|
@@ -34,7 +105,7 @@ const MapView = forwardRef<MapViewHandle, MapViewProps>( | |||
if (waypoints.length === 1) { | |||
mapRef.flyTo({ | |||
center: waypoints[0].coordinate, | |||
zoom: 15, | |||
zoom: CONST.MAPBOX.DEFAULT_ZOOM, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment for reference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a heads up, this has caused an issue in #32261
The zoom level was changed from 15 to 10 for web, but it's still 15 for other platforms.
This caused an issue when the default zoom and zoom when you select a location is the same, so if the default location and the location you've selected are the same - the map isn't zoomed in
This was changed back to 15 in #33234
Details
Thread: https://expensify.slack.com/archives/C01GTK53T8Q/p1698404342523299
Fixed Issues
$ #22704
PROPOSAL:
Tests
Web
There are three possibilities when testing the Web, depending on user's location permissions:
When page
Wants to know your location
:When location access allowed:
DistanceRequestFooter.js
add the following:Then open Request Money -> Distance. You should see the map initially load the [12, 12] coords, and after a second or so it should take you to your current location, once your location is obtained.
3. Do the same as in step 2., but before your current location is obtained, drag the map with the mouse. This should keep you at [12, 12] coords and should stop the map from auto-panning to your current location.
When location access is disabled:
Desktop
You have to control the location permissions from the system settings:
Test all the scenarios (enabled/ask/disabled) similarly to web.
Mobile
Control the location permissions through your phone settings:
Test all the scenarios (enabled/ask/disabled) similarly to web.
Offline tests
Map won't load in offline mode. Browser won't ask about granting location permissions.
QA Steps
Tests
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
(Ignore console warnings - I added them for easier debugging)
Screen.Recording.2023-10-31.at.17.45.24.mov
Android: mWeb Chrome
104006-480x1120.mp4
iOS: Native
Screen.Recording.2023-10-31.at.17.36.11.mov
Screen.Recording.2023-10-31.at.17.37.40.mov
iOS: mWeb Safari
Screen.Recording.2023-10-31.at.17.42.37.mov
Screen.Recording.2023-11-02.at.19.03.58.mov
Screen.Recording.2023-11-02.at.19.10.27.mov
MacOS: Chrome / Safari
Screen.Recording.2023-10-30.at.15.33.54.mov
MacOS: Desktop
Screen.Recording.2023-10-30.at.15.56.28.mov
Screen.Recording.2023-10-30.at.15.59.56.mov